package com.psy.counseling.config;

import cn.dev33.satoken.stp.StpInterface;
import com.psy.counseling.service.PermissionService;
import com.psy.counseling.service.RoleService;
import com.psy.counseling.service.impl.PermissionServiceImpl;
import com.psy.counseling.service.impl.RoleServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

/**
 * @Author 梁学儒
 * @Date 2022/5/30 15:01
 * @Version 1.0
 */

public class StpInterfaceImpl implements StpInterface {

    @Autowired
    private PermissionServiceImpl permissionService;

    @Autowired
    private RoleServiceImpl roleService;

    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        if(loginType.equals("login")) {
            //return rolePermissionService.getPermissionById();
            return permissionService.getPermissionById();
        } else {
            return null;
        }
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        if(loginType.equals("login")) {
            //return userRoleService.getRoleListById();
            return roleService.getRoleListById();
        }else {
            return null;
        }
    }
}
